package com.chunayev.numerology.gui.frame;

import java.awt.BorderLayout;
import java.awt.HeadlessException;

import javax.swing.Icon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 * @author Sergey Chunayev
 */
public class PictureFrame extends JFrame {
    
    /**
     * 
     */
    private static final long serialVersionUID = 8784547110326066641L;
    
    private final JLabel iconLabel;
    
    /**
     * 
     */
    public PictureFrame() {
        this(null);
    }
    
    /**
     * @param title
     * @throws HeadlessException
     */
    public PictureFrame(final String title) throws HeadlessException {
        super(title);
        final JPanel panel = new JPanel(new BorderLayout());
        iconLabel = new JLabel();
        panel.add(iconLabel);
        getContentPane().add(panel);
    }
    
    /**
     * @param icon
     * @see javax.swing.JLabel#setIcon(javax.swing.Icon)
     */
    public void setIcon(final Icon icon) {
        this.iconLabel.setIcon(icon);
    }
    
}
